// src/utils/message.ts
import { ElMessage } from 'element-plus';
// message初始化
export const showMessage = (type: 'success' | 'warning' | 'info' | 'error', message: string) => {
  ElMessage({
    message,
    type,
    duration: 3000,
  });
};
// 消息类型展示
export const showSuccessMessage = (message: string) => {
  showMessage('success', message);
};

export const showErrorMessage = (message: string) => {
  showMessage('error', message);
};

export const showWarningMessage = (message: string) => {
  showMessage('warning', message);
};

export const showInfoMessage = (message: string) => {
  showMessage('info', message);
};
// 消息规范化
export const messages = {
    registrationSuccess: '注册成功！欢迎加入我们。',
    registrationFailure: '用户注册失败，请稍后再试。',
    loginSuccess: '登录成功！欢迎回来。',
    loginFailure: '用户名或密码错误，请重试。',
    validationFailure: {
      username: '用户名必须为6-20位字母或数字。',
      password: '密码必须为10-20位，包含字母和数字。',
      empty:'用户名或密码不能为空'
    },
    tokenValidationFailure: '无效或已过期的令牌，请重新登录。',
    serverError: '服务器内部错误，请稍后再试。',
  };